package com.lzx.applib.utils;

/**
 * Created by Lzx on 16/09/12 0012.
 */
public class ParserUtil {

    private ParserUtil() {}

    public static int parse(String data, int def) {
        try {
            return Integer.parseInt(data.trim());
        } catch (Exception e) {
            return def;
        }
    }

    public static long parse(String data, long def) {
        try {
            return Long.parseLong(data.trim());
        } catch (Exception e) {
            return def;
        }
    }

    public static boolean parse(String data, boolean def) {
    	try {
    		return Boolean.parseBoolean(data.trim().toLowerCase());
		} catch (Exception e) {
			return def;
		}
    }
}
